<template>
  <div class="contaniner">
    <day-card :data ="dayData"></day-card>
   <!-- {{dayData}} -->
    <day-list :data="dayData"/>
  </div>

</template>

<script>

import getData from '@/services';
import { onMounted, computed,watch  } from 'vue';
import { useStore } from 'vuex'

import DayCard from '@/components/DayPage/Card'
import DayList from '@/components/DayPage/List/Lists'

import {getNowDate} from "@/libs/utils"


export default {
    name: 'DaPage',

    components:{
       DayCard,
      DayList,

    },
  setup(){
    const store = useStore(),
          state = store.state;
        console.log(state);
         
    watch (()=> {
        return state.dayData
      },()=>{
        store.commit ('setErrorCode',0);
       
      })

    onMounted(()=>{
      getData(store,'day', getNowDate('day'));
    });
    // console.log(computed(()=> state.dayData).value);
      return {
        dayData: computed(()=> state.dayData),
        errorCode: computed(()=>state.errorCode),
      }
     
  }
  


}
</script>

<style>

</style>